import request from "../../utils/request";
import { getStoreId } from "./store";
export function A() {
    return request({
        url: '/Goods/StoreSubpages',
        method: 'get',
        params: { StoreId: getStoreId() }
    })
}

export function getGoodsList() {
    return request({
        url: 'admin/Goods/getGoodsList',
        method: 'get',
        params: {
            StoreId: getStoreId()
        }
    })
}

export function getHostKey() {
    return request({
        url: 'admin/Goods/getHostKey',
        method: 'get',
        params: { StoreId: getStoreId() }
    })
}

export function deleteGoodsSubmit(el) {
    return request({
        url: 'admin/Goods/DeleteGoods',
        method: 'delete',
        params: { GoodsId: el.storeName + '_' + el.goodsType + '_' + el.id }
    })
}

export function batchDelete(array) {
    return request({
        method: 'delete',
        url: 'admin/Goods/batchDelete?ids=' + array,
    })
}

export function addGoods(infoFrom) {
    return request({
        url: 'admin/Goods/AddGoods',
        method: 'post',
        data: infoFrom,
    })
}

export function UPGoods(infoFrom) {
    return request({
        url: 'admin/Goods/UpGoods',
        method: 'put',
        data: infoFrom,
    })
}



export function getGoodId(GoodsType, goodsName) {
    return request({
        method: 'Get',
        url: "admin/Goods/GetGoodId",
        params: {
            StoreId: getStoreId(),
            GoodsType: GoodsType,
            goodsName: goodsName
        }
    })
}

export function GetById(goodsId) {
    return request({
        method: 'get',
        url: 'admin/Goods/GetById',
        params: { GoodsId: goodsId }
    })
}
export function getGoodsByImportanceKey(data) {
    return request({
        url: '/admin/Goods/GetByImportanceKey',
        method: 'post',
        data: data
    })
}
export function getGoodsType() {
    return request({
        url: '/admin/Goods/getGoodsType',
        method: 'get',
        params: {
            StoreId: getStoreId()
        }
    })
}
export function AddStoreType(typeName) {
    return request({
        url: '/admin/Goods/AddStoreType',
        method: 'post',
        params: {
            StoreId: getStoreId(),
            typeName: typeName
        }
    })
}
export function deleteStoreType(typeName) {
    return request({
        url: '/admin/Goods/deleteStoreType',
        method: 'delete',
        params: {
            StoreId: getStoreId(),
            typeName: typeName
        }
    })
}